<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Epoch权限管理系统</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="${baseStaticUrl}/plugins/bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="${baseStaticUrl}/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
    <!-- Theme style -->
  <link rel="stylesheet" href="${baseStaticUrl}/adminlte/css/AdminLTE.min.css">
  <link rel="stylesheet" href="${baseStaticUrl}/adminlte/css/skins/skin-blue.css">
  <script src="${baseStaticUrl}/plugins/jquery/jquery-2.2.3.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
  $.widget.bridge('uibutton', $.ui.button);
</script>
<!-- Bootstrap 3.3.6 -->
<script src="${baseStaticUrl}/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="${baseStaticUrl}/adminlte/js/app.min.js"></script>
<script src="${baseStaticUrl}/adminlte/js/pages/dashboard.js"></script>
<script type="text/javascript" src="${basePath}/js/common/MessageBox.js"></script>
<script src="${basePath}/js/common/common.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <header class="main-header">
    <!-- Logo -->
    <a href="javascript:void(0)" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini">Epoch</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg">Epoch<font size="2">(1.0开源版本)</font></span>
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
        <span class="sr-only">Toggle navigation</span>
      </a>

      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <li class="dropdown ">
            <a href="${basePath}/index/index" target= _blank>
              <i class="fa fa-home"></i>首页
            </a>
		  </li>
          <li class="dropdown tasks-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-tasks"></i>
              <span class="label label-danger">9</span>
            </a>
            <ul class="dropdown-menu">
          <li class="dropdown messages-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-envelope"></i>
              <span class="label label-success">${infoCount!"0"}</span>
            </a>
            <ul class="dropdown-menu">
              <li class="header">${infoCount!"0"}条消息公告</li>
              <li>
                <!-- inner menu: contains the actual data -->
                <ul class="menu">
                  @for(info in infoList){
                  <li><!-- start message -->
                    <a href="#">
                      <div class="pull-left">
                        <img src="${baseStaticUrl}/adminlte/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                      </div>
                      <h4>
                        ${lisFun.escapeForQuot(lisFun.getDictCode('SYS_INFO_TYPE',info.INFO_TYPE))}
                        <small><i class="fa fa-clock-o"></i>${info.UPDATE_DATE!,dateFormat="yyyy-MM-dd HH:mm:ss"}</small>
                      </h4>
                      <p>
	                      @desc=info.INFO_DESC;
	               		  @descValue=strutil.length(desc)>15 ? strutil.subStringTo(desc,0,15)+"..." : desc;
	               		  ${descValue!}
                      </p>
                    </a>
                  </li>
                  @}
                </ul>
              </li>
              <li class="footer"><a href="javascript:void(0)" onclick="toAllMessage()">查看全部</a></li>
            </ul>
          </li>
          <!-- User Account: style can be found in dropdown.less -->
          <li class="dropdown user user-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <img src="${baseStaticUrl}/adminlte/img/user2-160x160.jpg" class="user-image" alt="User Image">
              <span class="hidden-xs">${session.userInfo.user_name!}</span>
              <i class="ace-icon fa fa-caret-down"></i>
            </a>
            <ul class="dropdown-menu-right dropdown-menu" style="width:100px">
              	<li>
						<a href="javascript:void(0)" onclick="updatePassword()">
							<i class="ace-icon fa fa-cog"></i>
							修改密码
						</a>
					</li>
					<!-- <li>
						<a href="profile.html">
							<i class="ace-icon fa fa-user"></i>
							个人信息
						</a>
					</li> -->
					<li>
						<a href="javascript:void(0)" onclick="changeEpochStyle()">
							<i class="ace-icon fa fa-user"></i>
							首页风格
						</a>
					</li>
					<li class="divider"></li>
					<li>
						<a href="${basePath}/logout">
							<i class="ace-icon fa fa-power-off"></i>
							退出
						</a>
					</li>
            </ul>
          </li>
        </ul>
      </div>
    </nav>
  </header>
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- Sidebar user panel -->
      <div class="user-panel">
        <div class="pull-left image">
          <img src="${baseStaticUrl}/adminlte/img/user2-160x160.jpg" class="img-circle" alt="User Image">
        </div>
        <div class="pull-left info">
          <p>admin</p>
          <a href="#"><i class="fa fa-circle text-success"></i>在线</a>
        </div>
      </div>
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <epoch:menu></epoch:menu>
    </section>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
	  	<section class="content contentexpand epochContent" style="background:#fff;">
	      	<iframe scrolling="yes" name="main" frameborder="0" style="width:100%;min-height:200px;overflow:visible;background:#fff;" src="${basePath}/index/main"></iframe>
	    </section>
  </div>
  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Create the tabs -->
    <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
      <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
      <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content">
      <!-- Home tab content -->
      <div class="tab-pane" id="control-sidebar-home-tab">
        <h3 class="control-sidebar-heading">Recent Activity</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-birthday-cake bg-red"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

                <p>Will be 23 on April 24th</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-user bg-yellow"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>

                <p>New phone +1(800)555-1234</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-envelope-o bg-light-blue"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>

                <p>nora\@example.com</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-file-code-o bg-green"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>

                <p>Execution time 5 seconds</p>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

        <h3 class="control-sidebar-heading">Tasks Progress</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Custom Template Design
                <span class="label label-danger pull-right">70%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Update Resume
                <span class="label label-success pull-right">95%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-success" style="width: 95%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Laravel Integration
                <span class="label label-warning pull-right">50%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-warning" style="width: 50%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Back End Framework
                <span class="label label-primary pull-right">68%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-primary" style="width: 68%"></div>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

      </div>
      <!-- /.tab-pane -->
      <!-- Stats tab content -->
      <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
      <!-- /.tab-pane -->
      <!-- Settings tab content -->
      <div class="tab-pane" id="control-sidebar-settings-tab">
        <form method="post">
          <h3 class="control-sidebar-heading">General Settings</h3>

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Report panel usage
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Some information about this general settings option
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Allow mail redirect
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Other sets of options are available
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Expose author name in posts
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Allow the user to show his name in blog posts
            </p>
          </div>
          <!-- /.form-group -->

          <h3 class="control-sidebar-heading">Chat Settings</h3>

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Show me as online
              <input type="checkbox" class="pull-right" checked>
            </label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Turn off notifications
              <input type="checkbox" class="pull-right">
            </label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Delete chat history
              <a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
            </label>
          </div>
          <!-- /.form-group -->
        </form>
      </div>
      <!-- /.tab-pane -->
    </div>
  </aside>
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<epoch:winOpen id="epochStyleChange" title="风格切换" backdrop="false" width="380px" btnSave="确定">
      <table  id="cardetail" class="table table-bordered">
      		<tbody id="car">
				<tr class="table-list">
					<td width="340px">首页风格</td>
					<tr class="table-list">
						<td><input type="radio" value="ace" id="indexStyle" name="indexStyle">Ace风格</td>
					</tr>
					<tr class="table-list">
						<td><input type="radio" value="adminlte" id="indexStyle"  name="indexStyle">AdminLte风格</td>
					</tr>
					<tr class="table-list">
							<td><input type="radio" value="hplus" id="indexStyle"  name="indexStyle">H+风格</td>
					</tr>
				</tr>
			</tbody>
      </table>
</epoch:winOpen>
<epoch:winOpen id="update_passsword" title="修改密码" backdrop="false" width="420px" btnSave="确定">
        <div class="row visa-row">
            <div id="wait-msg_common_password" class="alert alert-info"
                 style="background:url(${baseStaticUrl}/images/ajax-loader.gif) no-repeat scroll 0.5em 50%;display:none"></div>
            <div id="alert-msg_common_password" class="alert alert-success" style="display:none"></div>
            <div id="error-msg_common_password" class="alert alert-danger" style="display:none"></div>
        </div>
      <form class="form-horizontal">
          <div class="form-group">
	          	<label for="firstname" class="col-sm-3 control-label">原始密码</label>
				<div class="col-sm-8">
				<input type="password" class="form-control input-sm" name="passwordOld" id="passwordOld" autocomplete="off">
				</div>
         </div>
          <div class="form-group">
	          	<label for="firstname" class="col-sm-3 control-label">新密码</label>
				<div class="col-sm-8">
					<input type="password" class="form-control input-sm" name="passwordNew" id="passwordNew" autocomplete="off">
				</div>
          </div>
          <div class="form-group">
	          	<label for="firstname" class="col-sm-3 control-label">确认密码</label>
				<div class="col-sm-8">
				<input type="password" class="form-control input-sm" id="passwordNeWToo" autocomplete="off">
				</div>
          </div>
      </form>
</epoch:winOpen>
<script src="${basePath}/js/index.js"></script>
<script type="text/javascript">

$(function() {
	$("input[type='radio'][name='indexStyle']").eq(1).attr("checked",true);

});

function changeEpochStyle(){
	$("#epochStyleChange").modal('show');
}

function updatePassword(){
	$("#update_passsword").modal('show');
}

//获取所有选中的组织
$("#epochStyleChange_save").click(function () {
	var sessionStyle = "${session.EPOCHSTYLE!}";
	var checkStyle = $('input[name="indexStyle"]:checked').val();
	if(checkStyle == sessionStyle){
		MessageBox.error("已经是此样式，无需切换")
	}else{
		$.ajax({
	        url: "${basePath}/index/changeStyle",
	        data: {style:checkStyle},
	        type: "post",
	        success: function (result) {
	            if (result) {
	            	if (result.code == "0") {
	                	MessageBox.success("样式切换成功，请重新刷新界面！");
	                } 
	            }
	        },
	        error: function () {
	        },
	        async: false
	    });
	}
	$("#epochStyleChange").modal('hide');
});

$("#update_passsword_save").click(function () {
    var passwordOld = $("#passwordOld").val();
    var passwordNew = $("#passwordNew").val();
    var passwordNewToo = $("#passwordNeWToo").val();
    if(passwordNew!=passwordNewToo){
        clearMessage();
        showErrorMessage("error-msg_common_password","两次密码不一致");
        return;
    }
    var userId= "${session.userInfo.id!}";
    $.post("${basePath}/sys/user/updatePassword", {
        "userId": userId,
        "passwordOld": passwordOld,
        "passwordNew": passwordNew
    }, function (msg) {
        if (msg == "true") {
            $("#cmn_label_update_passsword").modal("hide");
            $("#cmn_label_update_passsword").modal("hideModal");
            $("#passwordOld").val("");
            $("#passwordNew").val("");
            $("#passwordNeWToo").val("");
            MessageBox.success("修改密码成功");
            $("#update_passsword").modal('hide');
        } else {
            $("#cmn_label_update_passsword").modal("hide");
            $("#cmn_label_update_passsword").modal("hideModal");
            MessageBox.error("修改密码失败");
        }
    });
});

$("#update_passsword_close").click(function () {
	$("#update_passsword").modal('hide');
});


function toAllMessage(){
	window.location.hash = "/sys/info/index";
	window.main.location.href = getRootPath()+"/sys/info/index";
}

</script>
</body>
</html>